package thinkinjava4.ch13_strings;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Pattern标记
 */
public class ReFlags {
    public static void main(String[] args) {
        //CASE_INSENSITIVE不区分大小写
        //MULTILINE多行
        //具体细节参考 正则表达式.md
        Pattern p =
//                Pattern.compile("^java", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
                Pattern.compile("(?m)(?i)^java");
        Matcher m = p.matcher("java has regex\n" +
                "Java has regex\n" +
                "JAVA has pretty good regular expressions\n" +
                "Regular expressions are in Java");
        while (m.find()) {
            System.out.println(m.group());
        }
    }
}
